console.log("[文件合并][开始]")

var fs = require('fs');

var html = fs.readFileSync('dist/index.html').toString();

var css = fs.readFileSync('dist/css/index.css').toString();
html = html.replace('<link href=css/index.css rel=preload as=style><link href=js/index.js rel=preload as=script><link href=css/index.css rel=stylesheet>', `<style>${css}</style>`)

var js = fs.readFileSync('dist/js/index.js').toString();;
html = html.replace('<script src=js/index.js></script>', ``);

fs.writeFileSync('./api.html', html);
fs.appendFileSync('./api.html',`<script>${js}</script>`);
console.log('[文件合并][结束]')